import { Drawer } from 'antd';
import React, { useMemo } from 'react';
import { ISourceIntentionAPI } from '../common/type';

export const DetailsDrawer: React.FC<ISourceIntentionAPI.DetailsDrawerAPI> = ({ isShowDetail, onClose }) => {
  /**样式*/
  const prefixCls = 'SourecIntention-updata-';

  /**关闭抽屉方法*/
  const onCancel = () => {
    onClose();
  };

  /**监听record*/
  const recordObj = useMemo(() => {
    if (isShowDetail?.resObj?.id) {
      return isShowDetail?.resObj;
    } else {
      return {};
    }
  }, [isShowDetail]);

  return (
    <>
      <Drawer
        className={prefixCls + 'MaterialDetailDrawer'}
        title="意向公开详情"
        style={{ position: 'absolute', height: '100%', overflow: 'hidden' }}
        placement="right"
        onClose={onCancel}
        open={isShowDetail?.isShow} // isShowDetail
        getContainer={false}
        width={document.body?.clientWidth * 0.4}
        headerStyle={{ padding: '1rem' }}
        bodyStyle={{ padding: 0 }}
        closable={false}
        destroyOnClose={true}
      >
        抽屉
      </Drawer>
    </>
  );
};
